#!/bin/bash

coproc mycoproc { nc localhost 9999; }
MYOUTPUT=${mycoproc[0]}
MYINPUT=${mycoproc[1]}

run_openstack() {
local  params=$*
local var=

i=1
while ((i>0));do

echo -e "${params}\n--help\n" >&"$MYINPUT"
while true;do
    read var <&"$MYOUTPUT"
# openstack: '--help' is not an openstack command. See 'openstack --help'.
# Did you mean one of these?
# help
    if [ "${var:0:12}" == "openstack: '" ]; then
        read var <&"$MYOUTPUT"
        read var <&"$MYOUTPUT"
        break
    fi
    echo $var
#    sleep 0.1
done

((i--))
done
}

#echo kill $mycoproc_PID
#kill $mycoproc_PID


